<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title></title>
</head>
<body>
	<div id="odv" style="width:600px;height: 80px;border: 1px solid #000;color: red;font-size: 40px;"></div>
</body>
</html>
<script>

	function showtime(){
		var odv = document.getElementById('odv');
		var d = new Date();
		var year = d.getFullYear();
		var month = d.getMonth()+1;
		var day = d.getDate();
		var weekday = d.getDay();
		var hour = d.getHours();
		var min = d.getMinutes();
		var seconds = d.getSeconds();
		//周一 周二
		odv.innerHTML=year+"年"+month+"月"+day+"日"+weeks(weekday)+doublenum(hour)+":"+doublenum(min)+":"+doublenum(seconds);
	}

	function weeks(n) {
		var arr = ["周日","周一","周二","周三","周四","周五","周六"];
		return arr[n]
	}
	
	//设置定时器
	var i = 0;
	var timer=setInterval(showtime,1000);

	function doublenum(num){
		if (num<10) {
			return "0"+num;
		}else{
			return num
		}
	}

	// alert(weeks(weekday))
</script>